Screenshot of the error:

Code of client side:

jwt attached api:

Here's the jwt verifying function:
const authHeader = req.headers?.authorization;
if(!authHeader){
return res.status(401).send({message: 'Unauthorized access'})
}
const token = authHeader.split(' ')[1];
jwt.verify(token, process.env.SECRET_TOKEN, (err, decoded)=>{
if(err){
return res.status(403).send({message: 'Forbidden access'})
}
console.log('decoded', decoded);
req.decoded = decoded;
})
next();
}
This error isn't related to jwt. This error happens if you try to do something with res object after response is sent. You can try to use return statement after or along with all your res.send() statements on server and that should resolve this error.